﻿using System;
using System.Configuration;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.DBM;
using KPIS.GERP.GIMS.MODEL;
namespace KPIS.GERP.GIMS.DAL
{
    public sealed class SysUseMethodDAL
    {
        IDBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

        public SysUseMethodDAL()
        {

        }

        public IList<SysUseMethodInfo> GetUseMethod()
        {
            string strSQL;
            DataSet ds = null;
            DataRowCollection dr = null;
            IList<SysUseMethodInfo> infoList = new List<SysUseMethodInfo>();
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);

                dbManager.AddParameters(0, "@delete_status", SystemInfo._DeleteRecordStatus);

                strSQL = "SELECT * FROM icm_sys_ppr_use_method WHERE record_status <> @delete_status";

                ds = dbManager.ExecuteDataSet(CommandType.Text, strSQL);
                dr = ds.Tables[0].Rows;
                if (dr.Count > 0)
                {
                    for (int i = 0; i < dr.Count; i++)
                    {
                        SysUseMethodInfo info = new SysUseMethodInfo();

                        info.Seq = dr[i]["icm_ppr_use_method_seq"].ToString();
                        info.Name = dr[i]["icm_ppr_use_method_name"].ToString();

                        infoList.Add(info);
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
                //return null;
            }
            finally
            {
                dbManager.Dispose();
            }

            return infoList;
        }
    }
}
